﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace BrokerBase.Lib.Product
{
    public class AdjustRateItem:IAdjustRateItem
    {
        public AdjustRateItem()
        {

        }

        public AdjustRateItem(IAdjustRate adjRate):this()
        {
            this.Owner = adjRate;
        }

        public virtual IAdjustRate Owner { get; set; }

        public virtual string Name { get; set; }


        public virtual double Value { get; set; }

        public virtual bool IsExpression { get; set; }

        public virtual string Expression { get; set; }

        public virtual string Description { get; set; }

        public virtual int Id { get; set; }

        public virtual double GetCoefficient(IPolicy policy)
        {
            if (Owner.IsHasConverter)
                return Owner.ConverterInstance.GetCoefficient(policy, this);
            else
                return Value;
        }

    }
}
